﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="news.aspx.cs" Inherits="WebSite.admin.title.news" %>

 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>文章管理</title>
    <link href="../main.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" language="javascript">
        function CheckSelect(del, str) {
            var rt = true;
            var num = 0;
            var boxorder = 0;
            var objCheckBox;
            for (var i = 0; i < form1.length; i++) {
                ///alert(form1.elements[i].type);
                if (form1.elements[i].type == "checkbox") {
                    boxorder++;
                    objCheckBox = form1.elements[i];
                    ///alert(objCheckBox.checked);
                    if (objCheckBox.checked) {
                        if (boxorder > 1) {
                            //如果是第一个CheckBox，是用来全选全消的，这个不算，不用自加
                            num++;
                        }
                    }
                }
            }
            ///alert(num);
            if (!del) {
                if (num > 1) {
                    alert("此操作不允许选择多个事件");
                    rt = false;
                }
            }
            if (str == 'del') {
                if (num == 0) {
                    alert("你没有选择要删除的信息");
                    rt = false
                } else { return confirm('你确定要删除这些信息吗?'); }
                ///alert(rt);
            }
            else {
                if (str == 'update') {
                    if (num == 0) {
                        alert("你没有选择要更新的信息");
                        rt = false
                    } else { return confirm('你确定要更新这些信息吗?'); }
                    ///alert(rt);
                } 
            }
            return rt;
        }

        function SelectAll(sa) {
            ///全选/全消
            var objCheckBox;
            for (var i = 0; i < form1.length; i++) {
                if (form1.elements[i].type == "checkbox") {
                    objCheckBox = form1.elements[i];
                    objCheckBox.checked = sa;
                }
            }
        }
</script>
</head>
<body bgcolor="#F1F4F7">
    <form id="form1" runat="server">
    <div>
    <center>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F1F4F7">
<tr>
<td height="382" align="center" valign="top">
<table Width="98%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FAFBFC" class="img">
    <tr>
      <td width="5%"><img height="22" alt="SEARCH" src="../images/icon_search.gif" width="26" border="0" /></td>
      <td align="left"><asp:DropDownList ID="typeid" runat="server">
             <asp:ListItem Text="所有类别" Value="0"></asp:ListItem>
          </asp:DropDownList></td>
      <td align="left">文章标题：</td>
      <td align="left"><input size="25" name="keyword" id="keyword" runat="server" /></td>
      <td align="left"><asp:ImageButton ID="ImageButton1" ImageUrl="../images/button04.gif" runat="server" OnClick="ImageButton1_Click" /></td>
    </tr>
  </table>
  <br />
  
  <asp:GridView ID="GridView1" runat="server" Width="95%" CellPadding="4" ForeColor="#333333" DataKeyNames="newsid" AutoGenerateColumns="False" AllowPaging="True" pagesize="100" BorderStyle="Solid" BorderWidth="1px" OnRowDataBound="GridView1_RowDataBound"
      ShowFooter="false" EmptyDataText="没有数据记录！！" AllowSorting="True" OnSorting="GridView1_Sorting">
        <Columns>
            <asp:TemplateField ShowHeader="False" HeaderText="选择">
             <ItemStyle Width="30px" Wrap="False" />
             <HeaderTemplate>
                 <asp:CheckBox ID="CheckBox1" runat="server"></asp:CheckBox>
             </HeaderTemplate>
             <ItemTemplate>
                 <asp:CheckBox ID="CheckBox1" runat="server"></asp:CheckBox>
             </ItemTemplate>
            </asp:TemplateField>
        <asp:HyperLinkField DataNavigateUrlFields="newsid" DataNavigateUrlFormatString="addnews.aspx?nid={0}" HeaderText="文章标题" DataTextField="newsname" />
        <asp:BoundField HeaderText="文章分类" DataField="typeid" sortexpression="typeid" />
        <asp:BoundField HeaderText="是否显示" DataField="visible" sortexpression="visible" />
        <asp:BoundField HeaderText="是否推荐" DataField="isnew" sortexpression="isnew" />
        <asp:BoundField HeaderText="添加日期" DataField="updatetime" sortexpression="updatetime" />
        <asp:BoundField HeaderText="" DataField="newsid" sortexpression="newsid" />
        <asp:BoundField HeaderText="" DataField="typeid" sortexpression="typeid" />
        <asp:TemplateField ShowHeader="False" HeaderText="操作">
             <ItemTemplate>
               <asp:HyperLink ID="HyperLink1" runat="server" Target="_blank"><img height="16" src="../images/icon_view.gif" width="16" border="0" /></asp:HyperLink>
               <a href="addnews.aspx?nid=<%# Eval("newsid") %>" title="编辑"><img height="16" src="../images/icon_edit.gif" width="16" border="0" /></a>
               <a href="news.aspx?action=del&amp;nid=<%# Eval("newsid") %>" onclick="return confirm('确认要移除吗？')" title="移除"><img height="16" src="../images/icon_drop.gif" width="16" border="0" /></a>
             </ItemTemplate>
        </asp:TemplateField>
        </Columns>
             <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />             
             <PagerStyle BackColor="White" ForeColor="#333333" HorizontalAlign="Left" Font-Bold="True" Font-Size=30px />
             <HeaderStyle BackColor="#E2E7EB" Font-Bold="True" ForeColor="Black" HorizontalAlign="Left" />
             <AlternatingRowStyle BackColor="White" />
             <PagerSettings Visible="False" />
        </asp:GridView>
        
     <table Width="98%" border="0" cellspacing="0" cellpadding="0">
       <tr>
         <td height="25" align="right" bgcolor="#E9ECEF"><asp:Label ID="LblRecordCount" runat="server"></asp:Label>
            <asp:Label ID="LblCurrentIndex" runat="server"></asp:Label>
            <asp:Label ID="LblPageCount" runat="server"></asp:Label>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <asp:LinkButton ID="btnFirst" CommandArgument="first" OnClick="PagerButtonClick" runat="server">首 页</asp:LinkButton> 
            <asp:LinkButton ID="btnPrev" CommandArgument="prev" OnClick="PagerButtonClick" runat="server">上一页</asp:LinkButton> 
            <asp:LinkButton ID="btnNext" CommandArgument="next" OnClick="PagerButtonClick" runat="server">下一页</asp:LinkButton> 
            <asp:LinkButton ID="btnLast" CommandArgument="last" OnClick="PagerButtonClick" runat="server">尾 页</asp:LinkButton> 
             跳转到第<asp:DropDownList ID="ddlCurrentPage" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"> </asp:DropDownList>页&nbsp;
         </td>
       </tr>
    </table>
    
  <table Width="98%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="26%" align="left">&nbsp;<asp:ImageButton ID="ImageButton2" ImageUrl="../images/button09.gif" runat="server" OnClick="ImageButton2_Click" /></td>
    </tr>
  </table></td>
</tr>
</table></center>
 </div>
</form>
</body>
</html>
